<?php
  include "./include/om_config.inc";
  $smarty = new smartyWWW();
  $msg = "";
  if(isset($_POST['submitBtn']))
  {
    $contractCode = $_POST['itemName'];
    $openPrice    = $_POST['openPrice'];
    $highPrice    = $_POST['highPrice'];
    $lowPrice     = $_POST['lowPrice'];
    $closePrice   = $_POST['closePrice'];
    $bhavCopyDate = $_POST['insDateYear']."-".$_POST['insDateMonth']."-".$_POST['insDateDay'];
    $insertQuery = "INSERT INTO bhavcopycomex (exchange,contractCode,bhavcopyDate,openPrice,highPrice,lowPrice,closePrice)
                                       VALUES ('Comex','".$contractCode."','".$bhavCopyDate."',
                                       '".$openPrice."','".$highPrice."','".$lowPrice."','".$closePrice."')";
    $insertQueryResult = mysql_query($insertQuery);
    if($insertQueryResult)
      $msg = "Record insert for ".$contractCode." for date ".$bhavCopyDate;
    else
      $msg = "Error".mysql_error();
  }
  $smarty->assign("PHP_SELF",$_SERVER['PHP_SELF']);
  $smarty->assign("msg",$msg);
  $smarty->display("insertComex.tpl");
?>